set(COMMOM_DIR ${PROJECT_ROOT}/common)
set(HEADER_DIR ${PROJECT_ROOT}/include)

qelib_include_directories(${HEADER_DIR})

qelib_sources(
    ${COMMOM_DIR}/qe_argparse.c
    ${COMMOM_DIR}/qe_array.c
    ${COMMOM_DIR}/qe_assert.c
    ${COMMOM_DIR}/qe_bitmap.c
    ${COMMOM_DIR}/qe_bitstream.c
    ${COMMOM_DIR}/qe_buffer.c
    ${COMMOM_DIR}/qe_debug.c
    ${COMMOM_DIR}/qe_errno.c
    ${COMMOM_DIR}/qe_graph.c
    ${COMMOM_DIR}/qe_hash.c
    ${COMMOM_DIR}/qe_math.c
    ${COMMOM_DIR}/qe_memory.c
    ${COMMOM_DIR}/qe_metric.c
    ${COMMOM_DIR}/qe_pack.c
    ${COMMOM_DIR}/qe_queue.c
    ${COMMOM_DIR}/qe_sdtrace.c
    ${COMMOM_DIR}/qe_service.c
    ${COMMOM_DIR}/qe_string.c
    ${COMMOM_DIR}/qe_thread.c
    ${COMMOM_DIR}/qe_time.c
)

qelib_install_headers(
    ${HEADER_DIR}/qe_argparse.h
    ${HEADER_DIR}/qe_array.h
    ${HEADER_DIR}/qe_assert.h
    ${HEADER_DIR}/qe_bitmap.h
    ${HEADER_DIR}/qe_bitstream.h
    ${HEADER_DIR}/qe_bitops.h
    ${HEADER_DIR}/qe_buffer.h
    ${HEADER_DIR}/qe_debug.h
    ${HEADER_DIR}/qe_def.h
    ${HEADER_DIR}/qe_errno.h
    ${HEADER_DIR}/qe_graph.h
    ${HEADER_DIR}/qe_hash.h
    ${HEADER_DIR}/qe_list.h
    ${HEADER_DIR}/qe_macros.h
    ${HEADER_DIR}/qe_math.h
    ${HEADER_DIR}/qe_memory.h
    ${HEADER_DIR}/qe_metric.h
    ${HEADER_DIR}/qe_pack.h
    ${HEADER_DIR}/qe_queue.h
    ${HEADER_DIR}/qe_sdtrace.h
    ${HEADER_DIR}/qe_service.h
    ${HEADER_DIR}/qe_string.h
    ${HEADER_DIR}/qe_thread.h
    ${HEADER_DIR}/qe_time.h
    ${HEADER_DIR}/qelib.h
)

# Logger
qelib_sources_ifdef(CONFIG_ENABLE_LOG ${COMMOM_DIR}/qe_log.c)
qelib_install_headers_ifdef(CONFIG_ENABLE_LOG ${HEADER_DIR}/qe_log.h)

# shell
qelib_sources_ifdef(CONFIG_ENABLE_SHELL ${COMMOM_DIR}/qe_shell.c)
qelib_install_headers_ifdef(CONFIG_ENABLE_SHELL ${HEADER_DIR}/qe_shell.h)

# Initcall
qelib_sources_ifdef(CONFIG_INITCALL ${COMMOM_DIR}/qe_initcall.c)
qelib_install_headers_ifdef(CONFIG_INITCALL ${HEADER_DIR}/qe_initcall.h)

# Rollingfile
qelib_sources_ifdef(CONFIG_ROLLING_FILE ${COMMOM_DIR}/qe_rollingfile.c)
qelib_install_headers_ifdef(CONFIG_ROLLING_FILE ${HEADER_DIR}/qe_rollingfile.h)

# backtrace
qelib_sources_ifdef(CONFIG_BACKTRACE ${COMMOM_DIR}/qe_backtrace.c)
qelib_install_headers_ifdef(CONFIG_BACKTRACE ${HEADER_DIR}/qe_backtrace.h)